import {createContext, useState} from 'react'


export let Context = createContext()
let {Provider, Consumer} = Context
// export Consumer

export function ContextProvider({children}) {
  let [count, setCount] = useState(10)

  let setObj = {
    count,
    add(){
      setCount(++count)
    },
    reduce(){
      setCount(--count)
    }
  }

  return (
    <Provider value={setObj}>
      {children}
    </Provider>
  )
}